<h2>Rate Limit Status</h2>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<?php echo $html->script('highcharts/highcharts') ?>
<!--[if IE]>
    <?php echo $html->script('highcharts/excanvas.compiled') ?>
<![endif]-->
<script type="text/javascript">
var chart;
$(document).ready(function() {
    chart = new Highcharts.Chart({
        chart: {
            renderTo: 'chart',
            defaultSeriesType: 'line',
            margin: [50, 150, 60, 80]
        },
        /*
        title: {
            text: 'Monthly Average Temperature',
            style: {
                margin: '10px 100px 0 0' // center it
            }
        },
        subtitle: {
            text: 'Source: WorldClimate.com',
            style: {
                margin: '0 100px 0 0' // center it
            }
        },
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 
                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
            title: {
                text: 'Month'
            }
        },
        */
        yAxis: {
            title: {
                text: 'Rate Limit'
            },
            plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            }]
        },
        /*
        tooltip: {
            formatter: function() {
                    return '<b>'+ this.series.name +'</b><br/>'+
                    this.x +': '+ this.y +'°C';
            }
        },
        legend: {
            layout: 'vertical',
            style: {
                left: 'auto',
                bottom: 'auto',
                right: '10px',
                top: '100px'
            }
        },
        */
        series: [{
            name: 'Rate Limit',
            data: [<?= join(', ', array_values($session->read('RateLimitLog'))) ?>]
        }]
    });
    
    
});
</script>

<?php
/*
pr($status);
*/
$seconds = $status['reset_time_in_seconds'] - time();
$mins = floor($seconds / 60);
$secs = $seconds % 60;

//printf ("<p>%.2f seconds should display as %0d:%02d.</p>", $seconds, $mins, $secs);
?>

<ul>
<li><strong>remaining_hits:</strong> <?= $status['remaining_hits'] ?></li>
<li>Rate limit will be reset after <strong><?= sprintf("%02d:%02d", $mins, $secs) ?></strong>.</li>
</ul>

<div id="chart"></div>

<?php pr($session->read('RateLimitLog')); ?>

